<?php
require_once "../../Common/database.php";
require_once "../../Common/values.php";

   $result = mysql_query("SELECT * FROM tblUsers WHERE Name='$user'");
   $row = mysql_fetch_array($result);
if($row[s]>1)
{

switch($_GET[f2])
{

case('status');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblstatus WHERE `Key`='$_POST[key]'";


}
else
{
$query="UPDATE tblstatus SET Name='$_POST[name]', Line='$_POST[line]' ,Project='$_POST[project]' WHERE `Key`='$_POST[key]'";

}
mysql_query($query);

#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=status">Back</a>';
break;

case('applications');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblapplications WHERE `ID`='$_POST[id]'";


}
else
{
$query="UPDATE tblapplications SET Name='$_POST[name]' WHERE `ID`='$_POST[id]'";

}
mysql_query($query);

#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=status&f2='.$_GET[f2].'">Back</a>';
break;

case('Projects');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblprojects WHERE `Key`='$_POST[key]'";


}
else
{
$query="UPDATE tblprojects SET Name='$_POST[name]', Users='$_POST[users]' WHERE `Key`='$_POST[key]'";

}
mysql_query($query);

#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=Projects">Back</a>';
break;

case('folders');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblFolders WHERE `Key`='$_POST[key]'";


}
else
{
$query="UPDATE tblFolders SET Folder='$_POST[name]' WHERE `Key`='$_POST[key]'";
}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=folders">Back</a>';
break;

case('kbfolders');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblkbfolders WHERE `ID`='$_POST[key]'";


}
else
{
$query="UPDATE tblkbfolders SET Folder='$_POST[name]',Users='$_POST[users]' WHERE `ID`='$_POST[key]'";
}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=kbfolders">Back</a>';
break;

case('Proirty');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblProirty WHERE `Key`='$_POST[key]'";


}
else
{
$query="UPDATE tblProirty SET Name='$_POST[name]' WHERE `Key`='$_POST[key]'";
}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=Proirty">Back</a>';
break;

case('Select');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblSelect WHERE `Select`='$_POST[select]'";


}
else
{
$query="UPDATE tblSelect SET User='$_POST[user]', LogNumber='$_POST[lognumber]', Due='$_POST[due]', Assigned='$_POST[assigned]', Requestor='$_POST[requestor]', Subject='$_POST[subject]', Status='$_POST[status]', Closed='$_POST[closed]', Line='$_POST[line]', Proirty='$_POST[proirty]' , Project='$_POST[project]',Department='$_POST[department]',Branch='$_POST[branch]',Private='$_POST[private]' WHERE `Select`='$_POST[select]'";
}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[select];
echo '<p><a href="../../index.php?p=shview&f2=Select">Back</a>';
break;

case('dSelect');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tbldashboard2 WHERE `Select`='$_POST[select]'";


}
else
{
$query="UPDATE tbldashboard2 SET User='$_POST[user]', LogNumber='$_POST[lognumber]', Due='$_POST[due]', Assigned='$_POST[assigned]', Requestor='$_POST[requestor]', Subject='$_POST[subject]', Status='$_POST[status]', Closed='$_POST[closed]', Line='$_POST[line]', Proirty='$_POST[proirty]' , Project='$_POST[project]',Department='$_POST[department]',Branch='$_POST[branch]',Private='$_POST[private]' WHERE `Select`='$_POST[select]'";
}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[select];
echo '<p><a href="../../index.php?p=shview&f2=dSelect">Back</a>';
break;

case('branches');
if ($_POST[delete]=='checked')
{
$query="DELETE FROM tblbranches WHERE `ID`='$_POST[id]'";

}
else
{
$query="UPDATE tblbranches SET BranchName='$_POST[name]', BranchNumber='$_POST[number]' WHERE ID='$_POST[id]'";


}
mysql_query($query);
#echo $query ;
echo '<h3><center>Updated Helpdesk '.$_GET[f2].' > '.$_POST[name];
echo '<p><a href="../../index.php?p=shview&f2=branches">Back</a>';
break;

}
}
else
{
 echo '<h3>Access Dennied</h3>';
}

?>